#ifndef COLOUR_MAP_H_
#define COLOUR_MAP_H_

/**
 * @file ColourMap.h
 */

#include <qwt_color_map.h>

#include <QtCore/QObject>
#include <QtCore/QStringList>
#include <QtCore/QString>
#include <QtCore/QVector>

namespace spectrum {

/**
 * @class ColourMap
 *
 * @brief
 *
 * @details
 */

class ColourMap : public QObject
{
    private:
        Q_OBJECT

    public:
        /// Enumeration: Image colour map.
        enum ColourMapType
        { RAINBOW, HEAT, GRAY, GRAY_INV, JET, STANDARD };

    public:
        /// Constructor.
        ColourMap();

        /// Destructor.
        virtual ~ColourMap();

        /// Returns the colour map brightness
        double brightness() const { return _brightness; }

        /// Returns the colour map contrast
        double contrast() const { return _contrast; }

        /// Returns the colour map.
        QwtLinearColorMap *  map() { return &_colourMap; }

    signals:
        /// Signal emitted when the colour map is changed.
        void mapUpdated();

        /// Signal emitted when the colour map type is changed.
        void mapTypeChanged(int);

    public slots:
        /// Update the colour map setting the brightness and contrast.
        void update(double brightness = 0.5, double constrast = 1.0);

        /// Set the colour map.
        void set(ColourMapType type = RAINBOW);

        /// Sets the colour map type.
        void set(int type);

    private:
        /// Set the rainbow colour map.
        void _rainbow();

        /// Set the gray colour map.
        void _gray();

        /// Set the inverted gray colour map.
        void _grayInv();

        /// Set the heat colour map.
        void _heat();

        /// Set Jet colour map.
        void _jet();

        /// Set the standard Qwt image style colour map.
        void _standard();

    private:
        ColourMapType _type;

        double _brightness;
        double _contrast;

        QVector<QColor> _colours;
        QVector<double> _position;
        QVector<QColor> _colour;
        QVector<double> _pos;

        QwtLinearColorMap _colourMap;
};


} // namespace spectrum
#endif // COLOUR_MAP_H_
